package com.lee.taste.spider.sohu.xml;

import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.xml.sax.InputSource;
/**
 * 解析xml
 * @author isnower
 *
 */
public class XMLParase {

	public static Element parseXml(String xml) {
		
		SAXReader reader = new SAXReader();
        Document document = null;
        Element ele = null;
		try {
			document = reader.read(new InputSource(new ByteArrayInputStream(xml.getBytes("gb2312"))));
			ele = document.getRootElement();
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			return ele;
		}
	}
	
}
